|
|
 |
|
|
|
|
NdotV = Nx * Vx + Ny * Vy + Nz * Vz
If NdotV < 0 Then
Nx = -Nx
Ny = -Ny
Nz = -Nz
End If
' Get the hit color. CalculateHitColor depth, Objects, Me, _
eye_x, eye_y, eye_z, _
px, py, pz, _
Nx, Ny, Nz, _
DiffuseKr, DiffuseKg, DiffuseKb, _
AmbientKr, AmbientKg, AmbientKb, _
SpecularK, SpecularN, _
ReflectedKr, ReflectedKg, ReflectedKb, IsReflective, _
TransmittedKr, TransmittedKg, TransmittedKb, TransN, _
n1, n2, IsTransparent, R, G, B
End Sub |
|
|
|
|
|
|
|
|
Figure 17.12 shows seven spheres and a plane. The smaller spheres sit on top of the plane. The plane cuts the larger sphere slightly above its middle. |
|
|
|
|
|
|
|
|
A disk is a circular area on a plane. Once you have mastered the ability to intersect rays with planes, it is only a small step to intersect rays with circular disks. To determine where a ray intersects a disk, first determine where the ray intersects the plane containing the disk. Then simply determine whether the point of intersection lies within the radius of the disk. |
|
|
|
|
|
|
|
|
Figure 17.12
Seven spheres and a plane. |
|
|
|
|
|